import { ref } from 'vue';
import axios from 'axios';
// default:定义的是默认函数，不起名字
export default function useDog(){
    const dogList = ref([
        'https://images.dog.ceo/breeds/pembroke/n02113023_5032.jpg',
    ]);

    function getDog(){
        axios.get('https://dog.ceo/api/breeds/image/random').then(res=>{
            console.log(res.data.message)
            dogList.value.push(res.data.message);
        })
        .catch(err=>{
            alert(err.message)
        })
    }
    return {dogList,getDog}
}
